|
|
|
|
|
|
|
After you have created DBQUERY.HTM and DBSEARCH.ASP, you should be able to open the URL for DBQUERY.HTM, enter a few letters of the alphabet, and have the matching records displayed in the browser (see Figures 31.4 and 31.5). |
|
|
|
|
|
|
|
|
Figure 31.4
This page contains a standard HTML form that allows the
user to enter a value and post it to an ASP page for processing. |
|
|
|
|
|
|
|
|
Figure 31.5
VBScript code on the server returns the contents
of a recordset in the form of an HTML table. |
|
|
|
|
|
|
|
|
|
In your database search example, you used separate ASP and HTM files. You could have just as easily combined the two files into a single ASP file. The only change you would need to make would be to have the form action refer to the same page. You might also want to use an if statement to check for the form value to see if you need to display the results: |
|
|
|
|
|
|
|
|
<% If Request.Form("txtSearch") <> "" Then DisplayResults %> |
|
|
|
|
|
|
|
|
The preceding line of code assumes that you have written a custom function, DisplayResults, to execute the query.  |
|
|
|
|
|
|
|
|
|
|
Displaying Data with Drill-Down Links |
|
|
|
|
|
|
|
|
The code in Listings 31.3 and 31.4 uses an HTML form field to retrieve the search criteria from the user. The user must first type a value into a text box and press a button. However, many times it is more convenient to use hyperlinks to |
|
|
|
|
|